import request from '@/utils/request'
export function fetchList(parentId,params) {
  return request({
    url:'/productCategory/list/'+parentId,
    method:'get',
    params:params
  })
}
export function deleteProductCate(id) {
  return request({
    url:'/productCategory/delete/'+id,
    method:'post'
  })
}

export function createProductCate(data) {
  return request({
    url:'/productCategory/create',
    method:'post',
    data:data
  })
}

export function updateProductCate(id,data) {
  return request({
    url:'/productCategory/update/'+id,
    method:'post',
    data:data
  })
}

export function getProductCate(id) {
  return request({
    url:'/productCategory/'+id,
    method:'get',
  })
}

export function updateShowStatus(data) {
  return request({
    url:'/productCategory/update/showStatus',
    method:'post',
    data:data
  })
}

export function updateNavStatus(data) {
  return request({
    url:'/productCategory/update/navStatus',
    method:'post',
    data:data
  })
}

/**
 * 商品分类
 */
export function fetchListWithChildren() {
  return request({
    url:'/shop/product/category/list',
    method:'get'
  })
}


/**
 * 获取平台分类列表
 */
export function goodsCategoryTree() {
  return request({
    url:'/common/GoodsCategoryTree',
    method:'get'
  })
}

/**
 * 新增或保存商品分类
 */
export function updataProductCategory(data) {
  return request({
    url:'/shop/productCategory/create',
    method:'post',
    data:data
  })
}

/**
 *删除商品分类
 */
export function delProductCategory(class_id) {
  return request({
    url:'/shop/storeClass/delete',
    method:'post',
    data:{class_id:class_id}
  })
}

/**
 * 获取某个商品分类详情
 */
export function getProductCategoryInfo(id) {
  return request({
    url:'/shop/storeClass/detail',
    method:'get',
    params:{class_id:id}
  })
}

/**
 * 获取某个商品分类首页显示状态
 */
export function updataProductCategoryState(id,code) {
  return request({
    url:'/shop/storeClass/recommend',
    method:'post',
    params:{class_id:id,code:code}
  })
}
